package q836_isRectangleOverlap;

public class Solution {
    /*
    矩形重叠
    直接参考223题
     */
    public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
        int overX1 = Math.max(rec1[0], rec2[0]);
        int overY1 = Math.max(rec1[1], rec2[1]);
        int overX2 = Math.min(rec1[2], rec2[2]);
        int overY2 = Math.min(rec1[3], rec2[3]);

        return overX1 < overX2 && overY1 < overY2;
    }
}
